<template>
  <div class="box">
    <Scroll ref="scroll" class="content" :h="50">
      <div class="bg">
        <span class="icon iconfont icon-zuojiantou1" @click="goBack"></span>
        <img :src="userInfo.profile.backgroundUrl" />
      </div>
      <div class="title">
        <div class="photo">
          <img :src="userInfo.profile.avatarUrl" />
        </div>
        <div class="name">{{ userInfo.profile.nickname }}</div>
        <div class="detail">
          <div class="focus">
            <span>{{ userInfo.profile.follows }}</span> 关注
          </div>
          <div class="fans">
            <span>{{ userInfo.profile.followeds }}</span> 粉丝
          </div>
          <div class="grade">Lv.{{ userGrade }}</div>
        </div>
        <div class="des">行走在冬夜的冷风口</div>
      </div>
      <div class="tap">
        <van-tabs animated>
          <van-tab title="主页">
            <div class="tap-item">
              <div class="title-l">基本信息</div>
              <div class="itemList">村龄： 4年</div>
              <div class="itemList">性别： 女</div>
              <div class="itemList">年龄： 95后</div>
              <div style="color: #999; text-align: center;">
                查看全部<span class="iconfont icon-dibudaohanglan-"></span>
              </div>
            </div>
            <div class="collect">
              <div class="list-wrap">
                <div class="create-list">
                  <span>收藏歌单</span>
                  <!-- <span class="iconfont icon-jiahao"></span> -->
                </div>
                <div class="sing-list" v-for="(item, index) in singList">
                  <div class="photo">
                    <img :src="item.coverImgUrl" />
                  </div>
                  <div class="dra">
                    <span>{{ item.name }}</span>
                    <i
                      >{{ item.trackCount }}首, by{{ item.creator.nickname }}</i
                    >
                  </div>
                </div>
              </div>
            </div>
          </van-tab>
          <van-tab title="视频">
            <div class="tap-item"></div>
          </van-tab>
          <van-tab title="动态">
            <div class="tap-item"></div>
          </van-tab>
        </van-tabs>
      </div>
    </Scroll>
  </div>
</template>

<script>
import Vue from "vue";
import { mapGetters, mapState } from "vuex";
import { Tab, Tabs, Popup, Dialog } from "vant";
import Scroll from "@/components/global/scroll";
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(Popup);
Vue.use(Dialog);
export default {
  components: {
    Scroll,
  },
  computed: {
    ...mapGetters(["userInfo", "userGrade", "singList"]),
  },
  created() {
    this.$bus.$emit("hideMenu", false);
  },
  beforeDestroy() {
    this.$bus.$emit("hideMenu", true);
  },
  mounted() {
    let id = this.$store.getters.getId||this.$store.getters.userInfo.account.id;
    this.$store.dispatch("getUserGrade");
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss">
.box {
  width: 100%;
  background: #f8f8f8;

  .bg {
    width: 100%;
    height: 320px;
    img {
      display: block;
      width: 100%;
      height: 100%;
    }
    .icon {
      position: absolute;
      top: 20px;
      left: 12px;
      color: #fff;
      z-index: 2;
      font-size: 30px;
    }
  }
  .title {
    width: 90%;
    height: 130px;
    position: relative;
    top: -20px;
    left: 50%;
    margin-left: -45%;
    border-radius: 15px;
    background: #fff;

    // overflow: hidden;
    .photo {
      // overflow: hidden;
      width: 80px;
      height: 80px;
      border: 2px solid #fff;
      border-radius: 50%;
      position: absolute;
      top: -40px;
      left: 50%;
      margin-left: -40px;
      background: yellowgreen;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .name {
      margin: 0 auto;
      // margin-top: 60px;
      font-size: 24px;
      font-weight: 900;
      position: absolute;
      top: 45px;
      left: 112px;
    }
    .detail {
      position: absolute;
      top: 80px;
      left: 95px;
      display: flex;
      justify-content: center;
      font-size: 12px;
      color: #333;
      div {
        padding: 0 10px;
      }
      span {
        color: #999;
      }
    }
    .des {
      position: absolute;
      top: 100px;
      left: 114px;
      color: #999;
    }
  }
  .tap {
    width: 100%;
    overflow: hidden;
    /deep/.van-tabs__nav {
      background-color: #f8f8f8 !important;
      /deep/.van-tabs__line {
        width: 35px;
        bottom: 24px;
        height: 6px;
        // top: ;
      }
    }
    .tap-item {
      width: 90%;
      // height: 200px;
      border-radius: 15px;
      background: #fff;
      margin: auto;
      line-height: 30px;
      padding: 0 20px;
      box-sizing: border-box;
      .title-l {
        height: 50px;
        font-size: 18px;
        font-weight: 600;
        line-height: 50px;
      }
      .itemList {
        font-size: 14px;
        color: #999;
      }
    }
    .collect {
      .list-wrap {
        width: 90%;
        // height: 300px;
        margin: auto;
        background: #fff;
        border-radius: 15px;
        margin-top: 10px;
        padding: 0 20px;
        padding-bottom: 50px;
        box-sizing: border-box;
        .create-list {
          height: 40px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          span {
            color: #333;
            font-size: 18px;
            font-weight: 900;
          }
        }
        .sing-list {
          height: 60px;
          background: #fff;
          // margin-top: 20px;
          border-radius: 15px;
          display: flex;
          text-align: center;
          align-items: center;
          .photo {
            margin-right: 10px;
            width: 50px;
            height: 50px;
            border-radius: 15px;
            background: khaki;
            font-size: 10px;
            img {
              width: 100%;
              height: 100%;
            }
          }
          .dra {
            // width: 50%;
            display: flex;
            flex-direction: column;
            span {
              width: 250px;
              text-align: left;
              // font-size: 16px;
              color: #333;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
            }
            i {
              font-style: inherit;
              text-align: left;
              font-size: 12px;
              color: #999;
            }
          }
        }
      }
    }
  }
}
</style>
